package org.easy.elasticsearch.config.client;

import org.easy.elasticsearch.config.pool.ElasticSearchPool;
import org.elasticsearch.client.RestHighLevelClient;

import java.io.Closeable;
import java.io.IOException;

/**
 * 
 * @Title: ElasticSearchClient.java
 * @Package org.easy.elasticsearch.config.client
 * @Description: TODO
 * @author linNaibin
 * @date 2020年9月14日 上午10:45:12
 * @version V1.0
 */
public class ElasticSearchClient implements Closeable {
	private RestHighLevelClient restHighLevelClient;
	private String cluster;

	public RestHighLevelClient getRestHighLevelClient() {
		return restHighLevelClient;
	}

	public void setRestHighLevelClient(RestHighLevelClient restHighLevelClient) {
		this.restHighLevelClient = restHighLevelClient;
	}

	public String getCluster() {
		return cluster;
	}

	public void setCluster(String cluster) {
		this.cluster = cluster;
	}

	public ElasticSearchClient(RestHighLevelClient client, String cluster) {
		this.restHighLevelClient = client;
		this.cluster = cluster;
	}

	@Override
	public void close() throws IOException {
		ElasticSearchPool.returnClient(this);
	}
}
